Skip to content

[wp-block-themes]: document theme.json slug-normaliser bug class#59

Open
mikeyarce wants to merge 1 commit into
trunkfrom
add/theme-json-slug-normaliser-gotcha
Open

[wp-block-themes]: document theme.json slug-normaliser bug class#59
mikeyarce wants to merge 1 commit into
trunkfrom
add/theme-json-slug-normaliser-gotcha

Conversation

@mikeyarce

Copy link
Copy Markdown

Summary

Documents a silent failure in theme.json: WordPress hyphenates preset/custom slugs before emitting CSS vars, so a handwritten var() reference to the un-normalised slug resolves to nothing and quietly falls back. No error, layout looks roughly right — invisible without computed-style inspection.

Examples:

  • slug 3xl--wp--preset--font-size--3-xl
  • slug cardShadow--wp--custom--card-shadow

Under the hood, WP_Theme_JSON runs every slug through _wp_to_kebab_case(), which splits at digit/letter boundaries, camelCase transitions, and non-alphanumeric characters.

Changes

  • skills/wp-block-themes/references/theme-json.md — new "Slug normalisation gotcha" section with the explanation and a grep pattern for catching un-normalised references.
  • skills/wp-block-themes/references/debugging.md — new bullet under "Styles not applying" pointing at the gotcha section.

WordPress passes every preset/custom slug through _wp_to_kebab_case() before
emitting its CSS var, hyphenating at digit/letter boundaries and camelCase
transitions. Handwritten references to the un-normalised form silently fall
back, making the failure invisible without computed-style inspection.

Adds a "Slug normalisation gotcha" section to theme-json.md (with a grep
pattern for catching un-normalised references) and a cross-referenced bullet
under debugging.md § "Styles not applying".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @mikey.arce@principalwp.com.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: mikey.arce@principalwp.com.


To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant